class CreateReservations < ActiveRecord::Migration[5.2]
  def change
    create_table :reservations do |t|
      t.integer :restaurant_id, null: false,  limit: 8
      t.string  :name,          null: false,  limit: 16
      t.string  :mobile,        null: false,  limit: 11
      t.date    :date,          null: false
      t.integer :start_time,    null: false
      t.integer :end_time,      null: false
      t.integer :number,        null: false
      t.timestamps              null: false
    end

    add_foreign_key :reservations,  :restaurants

    add_index :reservations, :date
    add_index :reservations, :start_time
    add_index :reservations, :end_time
  end
end
